package com.cheer.param;

import cn.hutool.core.collection.CollectionUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
@ApiModel("列表查询Param")
public class LecCourseListParam extends BasePageParam{

    @ApiModelProperty("关键字")
    private String keyword;

    @ApiModelProperty("状态")
    private Integer status;

    @ApiModelProperty("机构")
    private Integer org;

    @ApiModelProperty("机构path")
    private String path;

    @ApiModelProperty("讲师")
    private String teaName;

    @ApiModelProperty("讲师ID")
    private Integer teaId;

    @ApiModelProperty("宣讲归属")
    private List<List<String>> belong;

    @ApiModelProperty("宣讲归属查询条件")
    private List<String> searchBelong;


    @ApiModelProperty("演讲开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date startTime;

    @ApiModelProperty("演讲结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endTime;


    public void setSearchBelong(){

        if(CollectionUtil.isNotEmpty(belong)){
            List<String> searchBelong = Lists.newArrayList();
            for (int i = 0; i <belong.size(); i++) {
                List<String> strings = belong.get(i);
                if(CollectionUtil.isNotEmpty(strings)){
                    searchBelong.add(strings.get(strings.size() - 1));
                }
            }
            this.searchBelong = searchBelong;
        }
    }




}
